package com.lingnan.blog.mapper;

import com.lingnan.blog.entity.View;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;import org.apache.ibatis.annotations.Select;

@Mapper
public interface ViewMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(View record);

    int insertSelective(View record);

    View selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(View record);

    int updateByPrimaryKey(View record);

    /**
     * 根据文章id和ip查询浏览记录
     *
     * @param aid 文章id
     * @param ip  ip地址
     * @return View记录
     */
    @Select("select * from view where a_id = #{aid} and u_id = #{uid} ")
    View selectViewByIpAndAid(@Param("aid") int aid, @Param("uid") String uid);
}